package com.doyambean.springcloud.consul.clientdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * consul，客户端服务，调用服务端。
 *
 * @author : xuchl
 * @date:20200217
 */
@SpringBootApplication
@EnableDiscoveryClient
public class ClientdemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(ClientdemoApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(RestTemplateBuilder rb) {
        return rb.build();
    }



}
